<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>toString</title>
<script type="text/javascript">
	function Person(name,age,gender){
		this.name=name;
		this.age=age;
		this.gender=gender;
	}
	//修改Person原型的toString
//	Person.prototype.toString =function(){
//		return "Person[name="+this.name+",age="+this.age+",gender="+this.gender+"]";
//	}
	var per =new Person("孙悟空","18","男");
	per.toString = function(){
		return "Person[name="+this.name+",age="+this.age+",gender="+this.gender+"]";
	}
	//创建一个Person实例
	
	//当我们直接在页面中打印一个对象时，实际上输出的对象的toString（）方法的返回值
	var result =per.toString();
	//console.log("result ="+result);
//	console.log(per.hasOwnProperty("toSting"));
//	console.log(per.__proto__.__proto__.hasOwnProperty("toSting"));
	console.log(per);
</script>
</head>
<body>
</body>
</html>
